﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[InitTabelaCauta]
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    insert into [tabelacampuricauta] (NumeTabela, NumeCamp, pozitie, [object_id],[column_id])

	SELECT o.name,c.name
    --,Count(*) cate
    ,column_id,c.object_id,column_id 
	from sys.columns c join sys.tables o on o.object_id = c.object_id
	where 
    not exists(select * from [tabelacampuricauta] b where 
		o.name=b.numetabela and c.name = b.numecamp)



END